home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 1 / MacMania 1.toast / Educational / Misc. / Save the Planet 1991 2.11 / card_43277.txt < prev    next >
Text File  |  1991-05-30  |  5KB  |  214 lines

  1. -- card: 43277 from stack: in.11
  2. -- bmap block id: 43664
  3. -- flags: 4000
  4. -- background id: 42812
  5. -- name: game
  6. ----- HyperTalk script -----
  7. On OpenCard
  8.   put the userLevel into saveLevel
  9.   if the userLevel < 3 then set userLevel to 3 --"Painting"
  10.   else
  11.   end if
  12.   if the userLevel < 3 then exit OpenCard
  13.   put 5 into x
  14.   choose rect tool
  15.   set pattern to 1
  16.   set filled to true
  17.   drag from 1,111 to 246,342
  18.   choose select tool
  19.   drag from 80,50 to 200,110 with commandKey
  20.   put " " into field "policy"
  21.   put 1990 into field "yr"
  22.   put 5.2 into field "pop"
  23.   put 1.17 into field "pp"
  24.   put 350 into field "co2"
  25.   put 1.7 into field "meth"
  26.   put 307 into field "n2o"
  27.   put 0 into field "tc"
  28.   put 0 into field "tf"
  29.   put " " into field "box1"
  30.   put " " into field "box2"
  31.   answer "Select CO2 emission policy" with "Increase" or "Decrease" or "Cancel"
  32.   if it contains "Cancel" then
  33.     reset paint
  34.     choose browse tool
  35.     pop card
  36.   else
  37.     put 1.0 into policy
  38.     if it contains "Increase" then
  39.       answer "Select 10 yr CO2 emission target %:" with "+20" or "+10" or  "No change"
  40.       if it contains "+20" then put 1.02 into policy else
  41.     end if
  42.     if it contains "+10" then put 1.01 into policy else
  43.   end if
  44.  
  45. else
  46.   if it contains "Decrease" then
  47.     answer "Select 10 yr CO2 emssion target %:" with "-50" or "-20" or "No change"
  48.     if it contains "-50" then put .95 into policy else
  49.   end if
  50.   if it contains "-20" then put .98 into policy else
  51. end if
  52.  
  53. end if
  54. end if
  55. put "  Initializing  w/ historical CO2 data" into field "policy"
  56. set cursor to watch
  57. put 0 into mmod
  58. put 5.112 into pop
  59. put 6.0 into carb
  60. put 3.0 into cnet
  61. put 1.7 into meth
  62. put 307.0 into n20
  63. put 0 into brkflg
  64. put random(4) + 1.5 into sens
  65. put random(56) + 19 into tau
  66. put sens into q
  67. divide q by 300.0
  68. put q into k1
  69. put tau -1 into q
  70. divide q by tau
  71. put q into k2
  72. repeat with yr = 1890 to 2050
  73.  
  74.   if yr < 1990 then
  75.     if yr mod 5 = 0 then
  76.       put yr into field "box1"
  77.       doMenu Flip Vertical
  78.     end if
  79.     if yr < 1960 then
  80.       put 40 into q
  81.       divide q by 70
  82.       put 295 + q * (yr - 1890) into ppm
  83.     else
  84.       put 70 into q
  85.       divide q by 30
  86.       put 335 + q * (yr - 1960) into ppm
  87.     end if
  88.   else
  89.     set cursor to hand
  90.     put " " into field "box1"
  91.     put pop * 1.014 into pop
  92.  
  93.     set the numberFormat to ".00"
  94.     put "     Annual CO2 multiplier =" && policy into field "policy"
  95.     put policy * carb into carb
  96.     put policy * cnet into cnet
  97.     put cnet into q
  98.     divide q by 700
  99.     put q + 1 into rate
  100.     put rate * ppm into ppm
  101.     put ppm - 295.0 into q
  102.     divide q by 2.0
  103.     put q + 295.0 into co2
  104.  
  105.     put co2 into q
  106.     divide q by 350.0
  107.     put (1.0 + 2 * (q - 1.0)) * 1.7 into  meth
  108.     put 0.877 * co2 into n2o
  109.   end if
  110.   put (ppm - 295.0) * k1 into temp1
  111.   put mmod * k2 into temp2
  112.   put temp1 + temp2 into mmod
  113.   put mmod * (1.0 - k2) into tc
  114.   if yr = 1990 then
  115.     put tc into ref
  116.     choose rect tool
  117.     set lineSize to 3
  118.     set pattern to 13
  119.     set filled to true
  120.   end if
  121.  
  122.   if yr > 1990 then
  123.     if yr mod 5 = 0 then
  124.       set the numberformat to "."
  125.       put yr into field "yr"
  126.       set the numberFormat to ".0"
  127.       put pop into field "pop"
  128.       put carb / pop into field "pp"
  129.       put co2 into field "co2"
  130.       put meth into field "meth"
  131.       put n2o into field "n2o"
  132.       put tc - ref into field "tc"
  133.       put (tc - ref) * 1.8 into field "tf"
  134.       put x + 12 into x2
  135.       put round(338 - (50 * (tc - ref))) into y
  136.       drag from x,338 to x2,y
  137.       put x + 20 into x
  138.     else
  139.     end if
  140.   else
  141.   end if
  142. end  repeat
  143. put "Model Sensitivity =" && sens into field "box1"
  144. put "Ocean Delay =" && tau into field "box2"
  145. reset paint
  146. choose browse tool
  147. set lineSize to 1
  148. end if
  149. set userLevel to saveLevel
  150. End OpenCard
  151.  
  152.  
  153. -- part 2 (button)
  154. -- low flags: 00
  155. -- high flags: A003
  156. -- rect: left=362 top=30 right=48 bottom=407
  157. -- title width / last selected line: 0
  158. -- icon id / first selected line: 0 / 0
  159. -- text alignment: 1
  160. -- font id: 0
  161. -- text size: 12
  162. -- style flags: 0
  163. -- line height: 16
  164. -- part name: Print
  165. ----- HyperTalk script -----
  166. on mouseUp
  167.   doMenu "Print Card"
  168. end mouseUp
  169.  
  170.  
  171.  
  172. -- part contents for background part 4
  173. ----- text -----
  174. 2050
  175.  
  176. -- part contents for background part 13
  177. ----- text -----
  178.      Annual CO2 multiplier = .95
  179.  
  180. -- part contents for background part 6
  181. ----- text -----
  182. 365.1
  183.  
  184. -- part contents for background part 3
  185. ----- text -----
  186. 11.9
  187.  
  188. -- part contents for background part 5
  189. ----- text -----
  190. .0
  191.  
  192. -- part contents for background part 7
  193. ----- text -----
  194. 1.8
  195.  
  196. -- part contents for background part 8
  197. ----- text -----
  198. 320.2
  199.  
  200. -- part contents for background part 10
  201. ----- text -----
  202. 1.1
  203.  
  204. -- part contents for background part 9
  205. ----- text -----
  206. 2.0
  207.  
  208. -- part contents for background part 11
  209. ----- text -----
  210. Model Sensitivity = 5.5
  211.  
  212. -- part contents for background part 12
  213. ----- text -----
  214. Ocean Delay = 52.0